package com.itheima.shuzu;

import java.util.Scanner;

public class Demo7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输人打分的评委人数:");
        int[] data = new int[sc.nextInt()];
        int min = 100, max = 0, sum = 0, score;
        for (int i = 0; i < data.length; i++) {
            while (true) {
                System.out.println("请输入第" + (i + 1) + "个评委的分数");
                score = sc.nextInt();
                if (score <= 100 && score >= 0) {
                    break;
                } else {
                    System.out.println("你输入的分数有误,请重新输入成绩:");
                }
            }
            data[i] = score;
            if (min > data[i]) {
                min = data[i];
            }
            if (max < data[i]) {
                max = data[i];
            }
            sum += data[i];
        }
        System.out.println("max = " + max);
        System.out.println("min = " + min);
        System.out.println("sum = " + (sum - min - max) / (data.length - 2) * 1.0);
    }
}
